<html>
 
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
  <link rel="stylesheet" type="text/css" href="{{ext_location}}/resources/css/ext-all.css">
 
  <script type="text/javascript" src="{{ext_location}}/adapter/ext/ext-base.js"></script>
 
  <script type="text/javascript" src="{{ext_location}}/ext-all-debug.js"></script>
 
  <title>Kanban</title>
 
  <script type="text/javascript">
Ext.QuickTips.init();

var addStoryHandler = function(button,event) {
	var form = new Ext.form.FormPanel({
		baseCls: 'x-plain',
		defaultType: 'textfield',
		items: [
			{
				fieldLabel: 'Titre',
				id: 'new_story_title',
				allowBlank: false,
				anchor:'100%',
			},
			{
				fieldLabel: 'Description',
				xtype: 'textarea',
				id: 'new_story_description',
				anchor:'100% -26',
			},
		],
	});
	
	var win = new Ext.Window({
		id : 'empty_story',
		modal : true,
		width: 500,
		height:250,
		minWidth: 300,
		minHeight: 200,
		bodyStyle:'padding:5px;',
		title : 'Nouvelle fiche',
		layout : 'fit',
		items : form,
		buttonAlign:'center',
		buttons: [
			{
				text: 'Créer',
				id : 'Créer',
				handler: function() {
					form.form.submit({
						clientValidation: false,
						method: 'POST',
						url:'kanban/add_story',
						success: function() { win.close(); },
						failure: function(param) { 
							Ext.Msg.alert('Erreur', 'Une erreur est survenue lors de la creation de la fiche.'); 
						},
					});
				}
			},
			{	text: 'Annuler',
				id : 'cancel_new_story',
				handler: function() {
					win.close();
				}
			},
		],
	})
	win.show()
};

  // Path to the blank image must point to a valid location on your server
  Ext.BLANK_IMAGE_URL = '/ext/resources/images/default/s.gif';
 
  Ext.onReady(function() {
	new Ext.Toolbar({
		renderTo: document.body,
		
		items: [
			{
				text: 'Ajouter',
				id : 'Ajouter',
				handler:addStoryHandler
				
			},
		]
	});
  });
  </script>
 
</head>
 
<body></body>
 
</html>